import { ipcMain, nativeTheme } from 'electron'
import ipcEventChannels from '../../common/ipcEventChannels'

export default () => {
    ipcMain.on(ipcEventChannels.THEME_CHANGE, (_, theme) => {
        nativeTheme.themeSource = theme
    })

    ipcMain.handle(ipcEventChannels.THEME_GET, () => {
        return nativeTheme.themeSource
    })

    ipcMain.handle(ipcEventChannels.THEME_IS_DARK, () => {
        return nativeTheme.shouldUseDarkColors
    })
}
